// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   BAG_TNImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BAG_TN;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.INT;
import com.sunwayhorizo.health.hl7.datatypes.TN;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;

import java.util.List;


// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            BAGCommonImpl, ANYImpl, CSImpl, NullFlavorImpl, 
//            TYPEImpl

public class BAG_TNImpl extends BAGCommonImpl
    implements BAG_TN
{

    public static final String RCS_ID = "$Header: BAG_TNImpl.java 115.18 2005/09/16 09:23:09 amchanda noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header: BAG_TNImpl.java 115.18 2005/09/16 09:23:09 amchanda noship $", "oracle.apps.ctb.hl7.types.common");
    private static final BAG_TN nullNI = new BAG_TNImpl(CSImpl.valueOf("NI"));
    private static final BAG_TN nullOTH = new BAG_TNImpl(CSImpl.valueOf("OTH"));
    private static final BAG_TN nullNINF = new BAG_TNImpl(CSImpl.valueOf("NINF"));
    private static final BAG_TN nullPINF = new BAG_TNImpl(CSImpl.valueOf("PINF"));
    private static final BAG_TN nullUNK = new BAG_TNImpl(CSImpl.valueOf("UNK"));
    private static final BAG_TN nullASKU = new BAG_TNImpl(CSImpl.valueOf("ASKU"));
    private static final BAG_TN nullNAV = new BAG_TNImpl(CSImpl.valueOf("NAV"));
    private static final BAG_TN nullMSK = new BAG_TNImpl(CSImpl.valueOf("MSK"));
    private static final BAG_TN nullNA = new BAG_TNImpl(CSImpl.valueOf("NA"));
    private static final BAG_TN nullNASK = new BAG_TNImpl(CSImpl.valueOf("NASK"));

    public static BAG_TN valueOf(List list)
    {
        if(list == null)
            throw ANYImpl.newNullException("BAG<TN>", "valueOf", "list");
        else
            return new BAG_TNImpl(list);
    }

    protected BAG_TNImpl(List list)
    {
        super(list);
    }

    protected BAG_TNImpl(CS cs)
    {
        super(cs);
    }

    public INT contains(TN tn)
    {
        return containsANY(tn);
    }

    public BAG_TN plus(BAG_TN bag_tn)
    {
        if(isNull().isTrue())
            return nullBAG_TN(NullFlavorImpl.NI);
        else
            return new BAG_TNImpl(plus(mList, bag_tn.toList()));
    }

    public BAG_TN minus(BAG_TN bag_tn)
    {
        if(isNull().isTrue())
            return nullBAG_TN(NullFlavorImpl.NI);
        else
            return new BAG_TNImpl(minus(mList, bag_tn.toList()));
    }

    public BAG_TN promotion(TN tn)
    {
        return new BAG_TNImpl(promoteItem(tn));
    }

    public TYPE dataType()
    {
        return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.BAG_TN;
    }

    public BL equal(ANY any)
    {
        throw ANYImpl.newUnsupportedException("BAG<TN>", "equal");
    }

    public int hashCode()
    {
        int i = 17;
        if(isNull().isFalse())
            i += mList.hashCode();
        return i;
    }

    protected boolean verifyItem(Object obj)
    {
        return obj instanceof TN;
    }

    public static BAG_TN nullBAG_TN(CS cs)
    {
        String s = null;
        if(cs == null || cs.literal().stringValue() == null || cs.isNull().isTrue())
            s = "NI";
        else
            s = cs.literal().stringValue();
        if(s.equals("NI"))
            return nullNI;
        if(s.equals("OTH"))
            return nullOTH;
        if(s.equals("NINF"))
            return nullNINF;
        if(s.equals("PINF"))
            return nullPINF;
        if(s.equals("UNK"))
            return nullUNK;
        if(s.equals("ASKU"))
            return nullASKU;
        if(s.equals("NAV"))
            return nullNAV;
        if(s.equals("MSK"))
            return nullMSK;
        if(s.equals("NA"))
            return nullNA;
        if(s.equals("NASK"))
            return nullNASK;
        else
            return nullNI;
    }

}
